<?php
/**
 * Created by viva.
 * User: xj
 * Tel:  13675170078
 * Date: 2015/6/8
 * Time: 17:12
 */
namespace Admin\Controller;
class FileController extends CommonController
{
    public function upload($PATHS)
    {
        $upload = new \Think\Upload();// 实例化上传类
        $upload->maxSize = 3145728;// 设置附件上传大小
        $upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
        $upload->rootPath = './Public/' . $PATHS . '/'; // 设置附件上传根目录
        // $upload->savePath  =     '123'; // 设置附件上传（子）目录
        $upload->replace = true;
        // 上传文件
        $info = $upload->upload();
        if (!$info) {// 上传错误提示错误信息
            $this->error($upload->getError());
        } else {// 上传成功
            return $info;
            //$this->success('上传成功！');
        }
    }

}